'use strict';
angular.module('user', [])
	.service('user', function ($localStorage,$q) {
		var storage = {};
		var _q = $q.defer();
		var _$q = $q.defer();
		this.get = function(name){
			if(!!$localStorage.user){
				return $localStorage.user[name]
			} else {
				return "";
			}
			
		};
		this.setId = function(name,value){  //设置值
			if(value){
				if(value && name){
					storage[name] = value;
				}
				_q.resolve(storage);
			}
		};
		this.getId = function(name){  //获取值
			return _q.promise;
		};
		this.response = function(s){
			if(s){
				_$q.resolve(s)
			} else{
				return _$q.promise;
			}
		}
});